package com.example.controller;

import java.util.List;

import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.vo.ResultVo;
import com.example.pojo.Entry;
import com.example.service.IEntryService;
import io.swagger.annotations.Api;
/**
 * <p>
 * 入职申请表（未完善） 前端控制器
 * </p>
 *
 * @author wsl
 * @since 2022-05-16
 */
@RestController
@RequestMapping("/entry")
@Api(tags = "入职申请表（未完善）",value = "")
@CrossOrigin(allowCredentials = "true")
public class EntryController {

    @Autowired
    private IEntryService entryService;

    @ApiOperation(value = "新增入职申请表（未完善）")
    @PostMapping("/add")
    public ResultVo addEntry(@RequestBody JSONArray jsonArray) {
        List<Entry> entries = jsonArray.toJavaList(Entry.class);
        Integer integer = entryService.insertEntry(entries);
        if (integer != 0 ){
            return ResultVo.ok();
        }
        return ResultVo.error();
    }
}
